/* const express = require('express')
const app = express();

app.get('/jsonp',(req,res)=>{
    let cb = req.query.callback;
    let data = {name:'jsonp接口',msg:'只支持get'};

    let str = `${cb}(${JSON.stringify(data)})`
    console.log(str)

    res.send(str)
})

const cors = require('cors')

// app.use(cors())
app.get('/home',(req,res)=>{
    res.send({name:'home',msg:'express'})
})

app.listen(8080,()=>{
    console.log('8080 running')
}) */

const express = require('express')
const app = express();
const cors = require('cors')
app.get('/jsonp',(req,res)=>{
    let cb = req.query.callback;
    let data = {name:'jsonp接口',msg:'只支持get'};

    let str = `${cb}(${JSON.stringify(data)})`
    console.log(str)

    res.send(str)
})
app.get('/home',(req,res)=>{
    res.send({name:'home',msg:'express'})
})

app.listen(8080,()=>{
    console.log('8080 running')
})